<% @valleyers.each do |valleyer| %>
  <% if valleyer.albums.length != 0 %>
    <div class="album_gather">
      <div class="auther">
        <div id="picture"><%= valleyer_logo_image_tag valleyer, {:width => 60, :height => 60} %></div>
        <%= link_to truncate(valleyer.nick_name, :length => 5),
          valleyer_url(valleyer),
          :target => :_blank,
          :class => "client_name",
          :title => valleyer.nick_name
      %>
      </div>
      <div class="albums_index">
        <div class="new_or_upload">
          <% if loggined_by? valleyer %>
            <%= link_to "创建相册",
              valleyer_url(:id => :none, :cmd => :new_album),
              :class => "foundAlbum",
              :target => :_blanck
          %>
            <p>|</p>
            <%= link_to "上传相片",
              valleyer_url(:id => :none, :cmd => :upload_photo),
              :class => "upload",
              :target => :_blanck
          %>
          <% end %>
        </div>
        <div class="content">
          <% valleyer.the_new_albums.each do |album| %>
            <div class="<%= album.new? ? 'monomer_new':'monomer_old' %>">
              <div class="picture">
                <% if album.photos.length == 0 %>
                  <%= image_tag 'valleyer/nil_album.jpg' %>
                <% else %>
                  <%= photo_image_tag album.new_photo_of_the_album, :height => 105 %>
                <% end %>
              </div>
              <div class="operate">
                <div class="summarize">
                  <div class="name">
                    <%= link_to truncate(album.name, :length => 5),
                      album_url(album),
                      :target => :_blanck,
                      :title => album.name
                  %>
                    <b>(<%= album.photos.length %>)</b>
                  </div>
                  <p class="message"><%= album.created_at.strftime("%Y年%m月%d日") %>更新</p>
                  <p class="message">浏览(<%= album.browse_records_count %>)评论(<%= album.post_sessions.length %>)</p>
                </div>
                <div class="maintain">
                  <% if loggined_by? album.author %>
                    <%= link_to image_tag("valleyer/edit_album.jpg"),
                      valleyer_url(:id => album.author.id, :cmd => :edit_album, :album_id => album.id),
                      :target => :_blanck
                  %>
                    <%= link_to_remote image_tag("valleyer/delete_album.jpg"),
                      :update => "subject",
                      :url => valleyers_show_album_url(album),
                      :method => :delete,
                      :html => {
                      :class => "delete_album"
                    }
                  %>
                  <% end %>
                </div>
              </div>
            </div>
          <% end %>
        </div>
      </div>
    </div>
  <% end %>
<% end %>
<%= page_turner(:album, @valleyers) %>